﻿using System;
using UnityEngine;

namespace UnityStandardAssets.ImageEffects
{
	// Token: 0x020004B4 RID: 1204
	[ExecuteInEditMode]
	[RequireComponent(typeof(Camera))]
	[AddComponentMenu("Image Effects/Other/Screen Overlay")]
	public class ScreenOverlay : PostEffectsBase
	{
		// Token: 0x060018E5 RID: 6373 RVA: 0x00070414 File Offset: 0x0006E814
		public override bool CheckResources()
		{
			base.CheckSupport(false);
			this.overlayMaterial = base.CheckShaderAndCreateMaterial(this.overlayShader, this.overlayMaterial);
			if (!this.isSupported)
			{
				base.ReportAutoDisable();
			}
			return this.isSupported;
		}

		// Token: 0x060018E6 RID: 6374 RVA: 0x00070450 File Offset: 0x0006E850
		private void OnRenderImage(RenderTexture source, RenderTexture destination)
		{
			if (!this.CheckResources())
			{
				Graphics.Blit(source, destination);
				return;
			}
			Vector4 vector = new Vector4(1f, 0f, 0f, 1f);
			this.overlayMaterial.SetVector("_UV_Transform", vector);
			this.overlayMaterial.SetFloat("_Intensity", this.intensity);
			this.overlayMaterial.SetTexture("_Overlay", this.texture);
			Graphics.Blit(source, destination, this.overlayMaterial, (int)this.blendMode);
		}

		// Token: 0x04000F6E RID: 3950
		public ScreenOverlay.OverlayBlendMode blendMode = ScreenOverlay.OverlayBlendMode.Overlay;

		// Token: 0x04000F6F RID: 3951
		public float intensity = 1f;

		// Token: 0x04000F70 RID: 3952
		public Texture2D texture;

		// Token: 0x04000F71 RID: 3953
		public Shader overlayShader;

		// Token: 0x04000F72 RID: 3954
		private Material overlayMaterial;

		// Token: 0x020004B5 RID: 1205
		public enum OverlayBlendMode
		{
			// Token: 0x04000F74 RID: 3956
			Additive,
			// Token: 0x04000F75 RID: 3957
			ScreenBlend,
			// Token: 0x04000F76 RID: 3958
			Multiply,
			// Token: 0x04000F77 RID: 3959
			Overlay,
			// Token: 0x04000F78 RID: 3960
			AlphaBlend
		}
	}
}
